<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <ul id="list"></ul>
    <script>
      const arr = [
        { name: 'ming', age: 12, sex: '男 ' },
        { name: 'hong', age: 11, sex: '女 ' },
        { name: 'qiang', age: 13, sex: '男 ' },
      ];
      const list = document.getElementById('list');
      for (let i = 0; i < arr.length; i++) {
        let oLi = document.createElement('li');
        let hdDiv = document.createElement('div');
        hdDiv.className = 'hd';
        hdDiv.innerText = arr[i].name + '的基本信息';
        let bdDiv = document.createElement('div');
        bdDiv.className = 'bd';
        let p1 = document.createElement('p');
        p1.innerText = '姓名:' + arr[i].name;
        let p2 = document.createElement('p');
        p2.innerText = '年龄:' + arr[i].age;
        let p3 = document.createElement('p');
        p3.innerText = '性别:' + arr[i].sex;
        bdDiv.appendChild(p1);
        bdDiv.appendChild(p2);
        bdDiv.appendChild(p3);
        oLi.appendChild(hdDiv);
        oLi.appendChild(bdDiv);
        list.appendChild(oLi);
      }
    </script>
  </body>
</html>
